<html>
<head><meta charset="utf-8"><title>SimdArray / Vector · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html">SimdArray / Vector</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242804117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242804117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242804117">(Jun 15 2021 at 21:47)</a>:</h4>
<p>Opened SimdArray::gather PR. <a href="https://github.com/rust-lang/stdsimd/pull/139">https://github.com/rust-lang/stdsimd/pull/139</a></p>



<a name="242805363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242805363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242805363">(Jun 15 2021 at 22:00)</a>:</h4>
<p>interesting.</p>



<a name="242805672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242805672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242805672">(Jun 15 2021 at 22:03)</a>:</h4>
<p><strong>some</strong> monomorphization failures. Fixed.</p>



<a name="242819236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242819236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242819236">(Jun 16 2021 at 01:11)</a>:</h4>
<p>Cool stuff <span class="user-mention" data-user-id="281757">@Jubilee</span></p>



<a name="242819258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242819258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242819258">(Jun 16 2021 at 01:11)</a>:</h4>
<p>Question: will we now only have <code>SimdArray</code> and stop talking about SIMD vectors?</p>



<a name="242819278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242819278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242819278">(Jun 16 2021 at 01:12)</a>:</h4>
<p>I'm assuming that Rust does not make meaningful distinctions at the type level between a vector and an array.</p>



<a name="242820981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242820981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242820981">(Jun 16 2021 at 01:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="246783">Miguel Raz Guzmán Macedo</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Scatter.2FGathers/near/242819278">said</a>:</p>
<blockquote>
<p>I'm assuming that Rust does not make meaningful distinctions at the type level between a vector and an array.</p>
</blockquote>
<p>So, for our purposes: vector is still meaningful, because they're still using vector registers. ^^;<br>
And we aren't manipulating true "arrays", because a SimdArray violates a specific rule about arrays: alignment. In a way that makes it safe to always turn a SimdArray into an array of the relevant type, mind, and easy to derive SimdArrays from regular arrays, but it's still overaligned.</p>
<p>So there's no real way to talk about SIMD types without double-qualifying them, because in Rust, the native "vector" for which people will pattern-match in their head is Vec, so we have to say "SIMD vector" or "SIMD array" or w/e.<br>
I chose the name SimdArray because arrays <strong>are</strong> our closest comparison point.</p>



<a name="242822221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242822221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242822221">(Jun 16 2021 at 02:05)</a>:</h4>
<p>one example difference: arrays are aligned to their element alignment regardless of total size, while simd values are generally aligned to their entire size.</p>



<a name="242832329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242832329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242832329">(Jun 16 2021 at 05:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="246783">Miguel Raz Guzmán Macedo</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Scatter.2FGathers/near/242819278">said</a>:</p>
<blockquote>
<p>I'm assuming that Rust does not make meaningful distinctions at the type level between a vector and an array.</p>
</blockquote>
<p>It absolutely does.  <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/enum.Abi.html#variant.Vector">Different ABIs</a>, at the very least.  And <code>Array</code> is a specific thing in <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/sty/enum.TyKind.html#variant.Array"><code>TyS</code></a>, but vectors aren't.</p>



<a name="242833007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242833007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242833007">(Jun 16 2021 at 06:01)</a>:</h4>
<p>Does the <code>Vector</code> ABI correspond to SIMD arrays or <code>[T; N]</code>? I assume it has nothing to do with <code>Vec&lt;T&gt;</code>...?</p>



<a name="242833431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242833431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242833431">(Jun 16 2021 at 06:09)</a>:</h4>
<p>SIMD arrays</p>



<a name="242833728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242833728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242833728">(Jun 16 2021 at 06:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Scatter.2FGathers/near/242832329">said</a>:</p>
<blockquote>
<p>And <code>Array</code> is a specific thing in <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/sty/enum.TyKind.html#variant.Array"><code>TyS</code></a>, but vectors aren't.</p>
</blockquote>
<p>How does that work? Is <code>SimdArray</code> a lang item, or is there some attribute magic to change the ABI of the type?</p>



<a name="242836055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242836055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242836055">(Jun 16 2021 at 06:38)</a>:</h4>
<p>it's just <code>#[repr(simd)]</code>, heh.</p>



<a name="242838442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242838442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242838442">(Jun 16 2021 at 07:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Scatter.2FGathers/near/242833728">said</a>:</p>
<blockquote>
<p>How does that work? Is <code>SimdArray</code> a lang item, or is there some attribute magic to change the ABI of the type?</p>
</blockquote>
<p>Attribute magic, <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ReprFlags.html#associatedconstant.IS_SIMD">via <code>ReprFlags</code></a>.</p>



<a name="242838569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/242838569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#242838569">(Jun 16 2021 at 07:12)</a>:</h4>
<p>(One could certainly consider having it no longer be a <code>repr</code>, though, if the way forward ends up being that there's just one const-generic type in core that's the only way for something to be a simd vector.  I don't think there's a <em>need</em> for it to be a <code>repr</code> when people could do that as a <code>repr(transparent)</code> wrapper around a type in core if they want a custom vector type, just like they do for arrays.)</p>



<a name="243461041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243461041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243461041">(Jun 22 2021 at 00:45)</a>:</h4>
<p>Something I may want to explore once your PR is in is putting <code>select</code> on the <code>Mask</code> trait, and somehow using <code>Vector</code> to indicate what can be <code>select</code>ed (not super different from how it works right now)</p>



<a name="243703310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243703310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243703310">(Jun 23 2021 at 19:50)</a>:</h4>
<p>Dragged some discussion/comments into a single topic here. This trait was discussed a fair amount in <a href="#narrow/stream/257879-project-portable-simd/topic/Meeting.202021-06-21">https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Meeting.202021-06-21</a><br>
We talked about using Vector as an alternate name. I'm in favor of "document the bikeshed", so at this point I'm happy with either tbh, as long as both names are in the commit history in case anyone sifts through git blame. :^)</p>



<a name="243703654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243703654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243703654">(Jun 23 2021 at 19:53)</a>:</h4>
<p>is SimdVector on the table?</p>



<a name="243704058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243704058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243704058">(Jun 23 2021 at 19:56)</a>:</h4>
<p>I think so.</p>



<a name="243705230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243705230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243705230">(Jun 23 2021 at 20:05)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> Vector would be consistent with Mask (which we already have and may need to expand)</p>



<a name="243705270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243705270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243705270">(Jun 23 2021 at 20:06)</a>:</h4>
<p>Which I think is part of the justification for dropping the "Simd"</p>



<a name="243708357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243708357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243708357">(Jun 23 2021 at 20:30)</a>:</h4>
<p>what i absolutely dont want is for people to start calling things <code>simd::Vector</code> or some nonsense like that</p>



<a name="243709788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243709788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243709788">(Jun 23 2021 at 20:41)</a>:</h4>
<p>I think people would use <code>Vector</code> unqualified, actually.</p>



<a name="243710300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243710300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243710300">(Jun 23 2021 at 20:45)</a>:</h4>
<p>Agreed</p>



<a name="243710373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243710373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243710373">(Jun 23 2021 at 20:45)</a>:</h4>
<p>Particularly because SIMD would usually only exist in specific parts of a program and not spread through the interfaces, probably</p>



<a name="243711438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243711438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243711438">(Jun 23 2021 at 20:52)</a>:</h4>
<p>I think I <strong>would</strong> see <code>simd::Vector</code> but I think we're going to see that anyways, imo, because some people just write all their code like that, no matter what, so we'd have to choose between <code>simd::SimdVector</code> and <code>simd::Vector</code>.</p>



<a name="243712872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243712872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243712872">(Jun 23 2021 at 21:05)</a>:</h4>
<p>i think SimdVector/Vector would be more common, given that that's what stuff like r-a autoimport will give you. i also think having to type it as simd::SimdVector would discourage that approach</p>



<a name="243714615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243714615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243714615">(Jun 23 2021 at 21:20)</a>:</h4>
<p>right. It's also not like <code>io::Error</code> where there's a bunch of different <code>Error</code> types and the path is particularly relevant, rather it would be an eccentric but unique name for std.</p>



<a name="243736131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243736131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243736131">(Jun 24 2021 at 02:45)</a>:</h4>
<p>Thoughts on removing <code>LanesAtMost32</code> and using <code>Vector</code> for that?</p>



<a name="243736217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243736217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243736217">(Jun 24 2021 at 02:46)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> I'm playing around with your implementation and I'm pretty sure the cycles come from using default implementations for all of the functions</p>



<a name="243736235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243736235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243736235">(Jun 24 2021 at 02:47)</a>:</h4>
<p>And from having various <code>where</code> clauses on the trait itself rather than on the implementations</p>



<a name="243737006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737006">(Jun 24 2021 at 03:07)</a>:</h4>
<p>I kinda wanted to be able to use that re: defaults. <span aria-label="weary" class="emoji emoji-1f629" role="img" title="weary">:weary:</span><br>
Actually I suppose it's fine if we just require scatter_select and gather_select to be implemented.</p>



<a name="243737331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737331">(Jun 24 2021 at 03:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/243736131">said</a>:</p>
<blockquote>
<p>Thoughts on removing <code>LanesAtMost32</code> and using <code>Vector</code> for that?</p>
</blockquote>
<p>I'm a little wary of doing this outright, since we want some kind of sealing trait period, but it'd depend on the thing in question.</p>



<a name="243737387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737387">(Jun 24 2021 at 03:16)</a>:</h4>
<p>I don't think we need one top level public sealing trait?</p>



<a name="243737403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737403">(Jun 24 2021 at 03:17)</a>:</h4>
<p>but in this case I'm suggesting <code>Vector</code> would be sealed directly</p>



<a name="243737408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737408">(Jun 24 2021 at 03:17)</a>:</h4>
<p>Oh okay.<br>
Sounds plausible.</p>



<a name="243737616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737616">(Jun 24 2021 at 03:22)</a>:</h4>
<p>The benefit of not using default implementations is you can then check the conditions (bounds, really) at implementation time and not have it as part of the trait at all</p>



<a name="243737707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737707">(Jun 24 2021 at 03:25)</a>:</h4>
<p>Still need a supertrait bounding <code>{SimdArray,Vector}</code> internally so as to prevent external implementers, but I suppose we're solid there.</p>



<a name="243737719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737719">(Jun 24 2021 at 03:25)</a>:</h4>
<p>yes, that's why I'm suggesting it's sealed directly</p>



<a name="243737978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243737978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243737978">(Jun 24 2021 at 03:31)</a>:</h4>
<p>Maybe I work that out after merge because it's a fairly big change with its own set of implications?</p>



<a name="243738178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243738178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243738178">(Jun 24 2021 at 03:35)</a>:</h4>
<p>Sounds good. I'm interested in larger refactorings based on this but I wanted to have the current diff be something contained.</p>



<a name="243738491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243738491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243738491">(Jun 24 2021 at 03:42)</a>:</h4>
<p>Ok I approved the branch as-is then</p>



<a name="243738776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243738776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243738776">(Jun 24 2021 at 03:48)</a>:</h4>
<p>( also it lets those refactorings be pursued out-of-order. )</p>



<a name="243738792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243738792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243738792">(Jun 24 2021 at 03:49)</a>:</h4>
<p>or superscalar if you prefer <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="243853814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243853814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243853814">(Jun 24 2021 at 22:19)</a>:</h4>
<p>So I was able to solve the problems using <code>const_evaluatable_checked</code> and bounds on the functions themselves, but that doesn't necessarily seem like the best option (right now, at least)</p>



<a name="243853905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243853905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243853905">(Jun 24 2021 at 22:20)</a>:</h4>
<p>there's the option of doing this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Vector</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Index</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">gather</span><span class="p">(</span><span class="o">..</span><span class="p">.,</span><span class="w"> </span><span class="n">idx</span>: <span class="nc">Index</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243853931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243853931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243853931">(Jun 24 2021 at 22:20)</a>:</h4>
<p>(which is how <code>to_bits</code>, etc are already handled</p>



<a name="243853995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243853995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243853995">(Jun 24 2021 at 22:22)</a>:</h4>
<p>It seems like without <code>const_evaluatable_checked</code> there's simply no way of representing relationships between const generics :)</p>



<a name="243854084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854084">(Jun 24 2021 at 22:23)</a>:</h4>
<p>the trait would probably end up looking something like:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Vector</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Scalar</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Index</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Bits</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243854345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854345">(Jun 24 2021 at 22:26)</a>:</h4>
<p>In some ways this might actually be better than using the types directly, IMO, because there are no bounds at all (on the trait) and they're all embedded in the fact that the trait is implemented.  So if you have <code>fn (_: impl Vector)</code> everything "just works" once you prove your type actually implements <code>Vector</code>, which is convenient</p>



<a name="243854395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854395">(Jun 24 2021 at 22:27)</a>:</h4>
<p>sorry could you explain what the different index types are? An array of usize value with a length equal to the vector length i take it?</p>



<a name="243854445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854445">(Jun 24 2021 at 22:27)</a>:</h4>
<p>Then with a <code>num-traits</code>-style crate you can write something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">V</span><span class="p">)</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">Vector</span>::<span class="n">Index</span>: <span class="nc">simd_traits</span>::<span class="n">Usize</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243854493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854493">(Jun 24 2021 at 22:28)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> exactly, it's just <code>SimdUsize&lt;LANES&gt;</code></p>



<a name="243854656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854656">(Jun 24 2021 at 22:30)</a>:</h4>
<p>it would be something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Vector</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">SimdF32</span><span class="o">&lt;</span><span class="n">LANES</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Scalar</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kt">f32</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="n">LANES</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Index</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">SimdUsize</span><span class="o">&lt;</span><span class="n">LANES</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243854806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854806">(Jun 24 2021 at 22:32)</a>:</h4>
<p>The downside of this is that it doesn't embed at all that <code>Index</code> is always a <code>SimdUsize&lt;...&gt;</code></p>



<a name="243854987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243854987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243854987">(Jun 24 2021 at 22:34)</a>:</h4>
<p>As a comparison, the "right" way with <code>const_evaluatable_checked</code> would be:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Vector</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Scalar</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">gather</span><span class="p">(</span><span class="o">..</span><span class="p">.,</span><span class="w"> </span><span class="n">idx</span>: <span class="nc">SimdUsize</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">SimdUsize</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span>: <span class="nc">Vector</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243855049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855049">(Jun 24 2021 at 22:35)</a>:</h4>
<p>(alternatively I think you can put that <code>where</code> clause on the entire trait, not just the fn, but not sure it makes a big difference)</p>



<a name="243855172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855172">(Jun 24 2021 at 22:37)</a>:</h4>
<p>Personally I think the <code>const_evaluatable_checked</code> way is the right way to go but it's not really clear how the timeline of that feature lines up with us going stable</p>



<a name="243855183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855183">(Jun 24 2021 at 22:37)</a>:</h4>
<p>Do consumers need it?</p>



<a name="243855196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855196">(Jun 24 2021 at 22:37)</a>:</h4>
<p>well, hard to say, it ends up in the bounds</p>



<a name="243855285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855285">(Jun 24 2021 at 22:38)</a>:</h4>
<p>even if it was allowed in core I don't think you could prove the bounds without it</p>



<a name="243855299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855299">(Jun 24 2021 at 22:38)</a>:</h4>
<p>so it would prevent it being used in generics, defeating the purpose, lol</p>



<a name="243855314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855314">(Jun 24 2021 at 22:39)</a>:</h4>
<p>hmm.</p>



<a name="243855394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855394">(Jun 24 2021 at 22:40)</a>:</h4>
<p>one option that's on the table is implement the trait, implement the functions directly on the types as well, and decide later whether the trait can be stabilized, should be changed, etc</p>



<a name="243855399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855399">(Jun 24 2021 at 22:40)</a>:</h4>
<p>I wouldn't mind inconveniencing some consumers.</p>



<a name="243855403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855403">(Jun 24 2021 at 22:40)</a>:</h4>
<p>but</p>



<a name="243855458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243855458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243855458">(Jun 24 2021 at 22:41)</a>:</h4>
<p>if we needed to get this out the door _today_ I feel like the best option would be to implement the fns directly on the types and then expose this trait in a crate and just update it to use <code>const_evaluatable_checked</code> when that becomes available</p>



<a name="243856119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856119">(Jun 24 2021 at 22:51)</a>:</h4>
<p>yeah, "don't use a trait initially" seems forward compatible</p>



<a name="243856295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856295">(Jun 24 2021 at 22:53)</a>:</h4>
<p>the only problem with that is right now <code>{to,from}_bitmask</code> is using a trait for the same problem (but it's confined to one relatively niche function)</p>



<a name="243856353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856353">(Jun 24 2021 at 22:54)</a>:</h4>
<p>and it's also something that would be solved by <code>const_evaluatable_checked</code>, as far as I can tell</p>



<a name="243856385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856385">(Jun 24 2021 at 22:54)</a>:</h4>
<p>and there's no way to implement it <em>at all</em> without either that or the hacky trait we have now</p>



<a name="243856429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856429">(Jun 24 2021 at 22:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/243855172">said</a>:</p>
<blockquote>
<p>Personally I think the <code>const_evaluatable_checked</code> way is the right way to go but it's not really clear how the timeline of that feature lines up with us going stable</p>
</blockquote>
<p>when do you wanna go stable <span aria-label="rofl" class="emoji emoji-1f923" role="img" title="rofl">:rofl:</span></p>



<a name="243856525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856525">(Jun 24 2021 at 22:56)</a>:</h4>
<p>sometime this year? feature wont be ready<br>
sometime next year? if a miracle happens maybe</p>



<a name="243856571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856571">(Jun 24 2021 at 22:56)</a>:</h4>
<p>relaxing bounds is also forward compatible and we are on nightly, so</p>



<a name="243856787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856787">(Jun 24 2021 at 22:59)</a>:</h4>
<p><span class="user-mention" data-user-id="326176">@Boxy [she/her]</span> this year would be extremely optimistic <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> next year is actually possible (likely?), I think</p>



<a name="243856822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243856822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243856822">(Jun 24 2021 at 22:59)</a>:</h4>
<p>yeah, agreed that we can relax bounds no problem</p>



<a name="243857010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857010">(Jun 24 2021 at 23:02)</a>:</h4>
<p>There's nothing particularly wrong with the hacky trait we can do now, it's the only way to do it on stable right now, but it requires treating the dependent types (the bitmasks, index types, etc) as generics as well</p>



<a name="243857056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857056">(Jun 24 2021 at 23:02)</a>:</h4>
<p>(in a function where the vector is generic, I mean)</p>



<a name="243857201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857201">(Jun 24 2021 at 23:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/243856787">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="326176">Boxy [she/her]</span> this year would be extremely optimistic <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> next year is actually possible (likely?), I think</p>
</blockquote>
<p>ah well guess you're wanting a miracle if you want const evaluatable checked on stable in next year :P</p>



<a name="243857275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857275">(Jun 24 2021 at 23:05)</a>:</h4>
<p><a href="https://www.youtube.com/watch?v=_-agl0pOQfs">https://www.youtube.com/watch?v=_-agl0pOQfs</a></p>
<div class="youtube-video message_inline_image"><a data-id="_-agl0pOQfs" href="https://www.youtube.com/watch?v=_-agl0pOQfs"><img src="https://uploads.zulipusercontent.net/e54a8206ac1932b0b95394e3cf29fa576cea1726/68747470733a2f2f692e7974696d672e636f6d2f76692f5f2d61676c30704f5166732f64656661756c742e6a7067"></a></div>



<a name="243857276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857276">(Jun 24 2021 at 23:05)</a>:</h4>
<p>lol, yeah I'm thinking we probably should not rely on const eval checked</p>



<a name="243857376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857376">(Jun 24 2021 at 23:06)</a>:</h4>
<p>the "hacky" trait solution is actually pretty good, since it's what we're already using for bitmasks</p>



<a name="243857433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857433">(Jun 24 2021 at 23:07)</a>:</h4>
<p>the problem is are we going to feel like we painted ourselves into a corner in say 3 years</p>



<a name="243857472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857472">(Jun 24 2021 at 23:07)</a>:</h4>
<p>Just gonna channel Boxy if we need to break all our nightly users.</p>



<a name="243857473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857473">(Jun 24 2021 at 23:07)</a>:</h4>
<p>vs. are we going to stymie adoption completely by not just getting something out the door that works...</p>



<a name="243857547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857547">(Jun 24 2021 at 23:08)</a>:</h4>
<p>is this a "put something in std that cant ever have a breaking change" kind of situation<br>
or a<br>
"we have a library that we'd rather not release a massive breaking change in" kind of situation</p>



<a name="243857573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857573">(Jun 24 2021 at 23:08)</a>:</h4>
<p>yeah sort of the first</p>



<a name="243857613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857613">(Jun 24 2021 at 23:09)</a>:</h4>
<p>we're going to be on nightly for a while, so.</p>



<a name="243857618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857618">(Jun 24 2021 at 23:09)</a>:</h4>
<p>and we can leave certain elements unstable for quite a while.</p>



<a name="243857624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857624">(Jun 24 2021 at 23:09)</a>:</h4>
<p>with const eval checked there is a decent quality-of-life improvement we can do (but the other option we have is definitely usable)</p>



<a name="243857625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857625">(Jun 24 2021 at 23:09)</a>:</h4>
<p>We can figure things out as we go.</p>



<a name="243857642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857642">(Jun 24 2021 at 23:09)</a>:</h4>
<p>agreed, we can also just decide to leave gather perma-unstable until that's sorted out, if we're ok with that</p>



<a name="243857699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857699">(Jun 24 2021 at 23:10)</a>:</h4>
<p>same goes for <code>{to,from}_bitmask</code></p>



<a name="243857725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243857725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243857725">(Jun 24 2021 at 23:10)</a>:</h4>
<p>I guess it's also true for shuffles though that's probably going to be usable sooner</p>



<a name="243858065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858065">(Jun 24 2021 at 23:15)</a>:</h4>
<p><code>packed_simd</code> had some pretty strong adoption in spite of being a highly unstable and experimental nightly crate, so I think we'll also see some significant adoption imo.</p>



<a name="243858079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858079">(Jun 24 2021 at 23:15)</a>:</h4>
<p>the real problem is not maintaining some forward momentum, I think.</p>



<a name="243858095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858095">(Jun 24 2021 at 23:15)</a>:</h4>
<p>Even if it's only a little momentum.</p>



<a name="243858193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858193">(Jun 24 2021 at 23:17)</a>:</h4>
<p>I think you're right, which makes me think we should make as much as possible "correct" enough that we'd be confident stabilizing it relatively quickly</p>



<a name="243858216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858216">(Jun 24 2021 at 23:17)</a>:</h4>
<p>but I suppose if this only affects a few things like gather it's probably not a big deal</p>



<a name="243858315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858315">(Jun 24 2021 at 23:18)</a>:</h4>
<p>is there any major issue putting the functions directly on the types, then providing the best trait we believe we can write currently, so at least in the future the regular fns can be stabilized?</p>



<a name="243858349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858349">(Jun 24 2021 at 23:19)</a>:</h4>
<p>there is the inherent fns issue but that's just another big unknown</p>



<a name="243858370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858370">(Jun 24 2021 at 23:19)</a>:</h4>
<p>Breaks less code if people are already importing the trait.</p>



<a name="243858442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858442">(Jun 24 2021 at 23:20)</a>:</h4>
<p>only if we make the assumption that the code using the traits have no intention on going to stable when possible</p>



<a name="243858499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858499">(Jun 24 2021 at 23:21)</a>:</h4>
<p>but also i'm suggesting that the regular fns we design from the start to go to stable, so there's no code breaking at all</p>



<a name="243858519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858519">(Jun 24 2021 at 23:21)</a>:</h4>
<p>when the regular fns go stable we can still keep the trait around, it just won't be stable (yet)</p>



<a name="243858681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858681">(Jun 24 2021 at 23:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/243858442">said</a>:</p>
<blockquote>
<p>only if we make the assumption that the code using the traits have no intention on going to stable when possible</p>
</blockquote>
<p>That's still an active choice on their part, though.</p>



<a name="243858764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858764">(Jun 24 2021 at 23:24)</a>:</h4>
<p>Maybe we aren't on the same page</p>



<a name="243858794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858794">(Jun 24 2021 at 23:24)</a>:</h4>
<p>Saying "if we stabilize N, then we must also stabilize M, because the users of N want to move to stable and also use M" means that there is no option but a single stabilization, period.</p>



<a name="243858872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858872">(Jun 24 2021 at 23:25)</a>:</h4>
<p>I'm suggesting we do both:</p>
<ul>
<li>Write inherent fns that have no technical barriers blocking their stability</li>
<li>Write the trait as you imagined with the current technical limitations we have, and reevaluate it in the future</li>
</ul>



<a name="243858955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858955">(Jun 24 2021 at 23:26)</a>:</h4>
<p>I think that would look quite a bit like inherent traits, but manual</p>



<a name="243858997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243858997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243858997">(Jun 24 2021 at 23:27)</a>:</h4>
<p>I don't actually care about inherent traits, I already went over my stance independent of those, and I regret bringing them up.</p>



<a name="243859015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243859015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243859015">(Jun 24 2021 at 23:27)</a>:</h4>
<p>Haha okay we can ignore them</p>



<a name="243859132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243859132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243859132">(Jun 24 2021 at 23:29)</a>:</h4>
<p>All I am saying is that I think it's a minor inconvenience to provide regular fns <em>also</em></p>



<a name="243859218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243859218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243859218">(Jun 24 2021 at 23:30)</a>:</h4>
<p>Because I don't see any reason to stop at scatter/gather, array conversion for example should be part of the trait as well</p>



<a name="243859308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243859308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243859308">(Jun 24 2021 at 23:31)</a>:</h4>
<p>I'm just fairly confused at this point about what is being discussed, since I feel like we are rehashing the discussion from Monday, so I will pick up this conversation a bit later.</p>



<a name="243860843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243860843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243860843">(Jun 24 2021 at 23:49)</a>:</h4>
<p>I am saying that no matter what there is a compromise in the trait, and suggesting that if we provide regular functions along with the trait that gives us an option for stabilization that doesn't rely on const eval checked</p>



<a name="243861496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243861496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243861496">(Jun 24 2021 at 23:56)</a>:</h4>
<p>The revelation since Monday is that removing the generic parameter from SimdArray requires that compromise</p>



<a name="243866121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866121">(Jun 25 2021 at 01:16)</a>:</h4>
<p>We should take the longest term view with design and then stabilization.</p>
<p>I think if we have direct methods (including ops methods) that <em>alone</em> is enough to stabilize even if a trait is added later, even if later is years later while const eval builds up.</p>



<a name="243866221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866221">(Jun 25 2021 at 01:18)</a>:</h4>
<p>The <code>wide</code> crate gets reasonable usage adoption without any ability to be generic over simd lane count or anything of that sort.</p>



<a name="243866285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866285">(Jun 25 2021 at 01:20)</a>:</h4>
<blockquote>
<p>Breaks less code if people are already importing the trait.</p>
</blockquote>
<p>I think one thing here is that (if i understand right!) additional trait stuff later doesn't break old code at all, it just makes the old code not as great as it could be. But that's always going to happen anyway because the alternative is that our standard library never gets better.</p>



<a name="243866474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866474">(Jun 25 2021 at 01:24)</a>:</h4>
<p>Yeah, that's basically what I was getting at. I don't want to compromise on the trait because we're using a half complete feature, but we don't have to compromise on the regular fns at all, and we can always add more trait features in the future but we can't fix how we implemented a trait in the past</p>



<a name="243866512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866512">(Jun 25 2021 at 01:25)</a>:</h4>
<p>And maybe I'm being optimistic but I can see stdsimd being stabilized in a year or so because it's useful as is, but the features required for the trait could take years I think</p>



<a name="243866566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866566">(Jun 25 2021 at 01:26)</a>:</h4>
<p>just pointing out: historically the fact that the trait would cause compromises is why theres no trait for the numeric types. iiuc, anyway</p>



<a name="243866592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866592">(Jun 25 2021 at 01:27)</a>:</h4>
<p>Yeah I agree with that.  Though we fundamentally need a trait regardless because we need to limit our lane counts</p>



<a name="243866597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866597">(Jun 25 2021 at 01:27)</a>:</h4>
<p>yeah, minimalism there might be for the best, though</p>



<a name="243866601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866601">(Jun 25 2021 at 01:27)</a>:</h4>
<p>Everything shows up slower than expected, but the relative scale of things is often broadly correct. Likely const_eval_checked will show up several times farther in the future than stdsimd alone without it.</p>



<a name="243866732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866732">(Jun 25 2021 at 01:30)</a>:</h4>
<p>So basically the question I was asking is where do we draw the line?  I think we can trivially put things like splat or array conversions on the trait no problem</p>



<a name="243866751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866751">(Jun 25 2021 at 01:30)</a>:</h4>
<p>Gather requires some compromise somewhere</p>



<a name="243866762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866762">(Jun 25 2021 at 01:30)</a>:</h4>
<p>I think the bare minimum the trait should have the lane count and scalar type</p>



<a name="243866781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866781">(Jun 25 2021 at 01:31)</a>:</h4>
<p>how harmful would it be to just have GatherScatter be a separate additional trait later on?</p>



<a name="243866792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866792">(Jun 25 2021 at 01:31)</a>:</h4>
<p>like, sub-trait i think the term is</p>



<a name="243866819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866819">(Jun 25 2021 at 01:32)</a>:</h4>
<p>Well our trait is sealed so we can also just add functions in the future, no problem</p>



<a name="243866845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866845">(Jun 25 2021 at 01:32)</a>:</h4>
<p>fair enough</p>



<a name="243866921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866921">(Jun 25 2021 at 01:34)</a>:</h4>
<p>I didn't want to just remove scatter/gather from the trait entirely since I think that's the opposite of jubilee's intention</p>



<a name="243866954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243866954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243866954">(Jun 25 2021 at 01:35)</a>:</h4>
<p>But I think regular fns is the safe path to stabilization at least</p>



<a name="243867007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243867007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243867007">(Jun 25 2021 at 01:36)</a>:</h4>
<p>well even if they are on the trait they can be stabilized separately, i suppose?</p>



<a name="243867037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243867037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243867037">(Jun 25 2021 at 01:37)</a>:</h4>
<p>Yeah I think so</p>



<a name="243872754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243872754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243872754">(Jun 25 2021 at 03:43)</a>:</h4>
<p>A little update, without <code>const_evaluatable_checked</code> we can't actually even implement <code>{to,from}_array</code> in the trait:</p>
<div class="codehilite"><pre><span></span><code>error: constant expression depends on a generic parameter
  --&gt; crates/core_simd/src/array.rs:25:26
   |
25 |     fn to_array(self) -&gt; [Self::Scalar; Self::LANES];
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this may fail depending on what value the parameter takes
</code></pre></div>



<a name="243872832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243872832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243872832">(Jun 25 2021 at 03:45)</a>:</h4>
<p>Again it could be done with something like</p>
<div class="codehilite"><pre><span></span><code>pub trait Vector {
    type Array;
    fn to_array(self) -&gt; Array;
}
</code></pre></div>
<p>but that doesn't really feel like a permanent solution</p>



<a name="243873016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873016">(Jun 25 2021 at 03:50)</a>:</h4>
<p>You don't actually need it at all, it's just Into/From. The entire method can be dropped.</p>



<a name="243873026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873026">(Jun 25 2021 at 03:50)</a>:</h4>
<p>Agreed, I thought it was common enough that we thought it deserved a proper name</p>



<a name="243873047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873047">(Jun 25 2021 at 03:52)</a>:</h4>
<p>That breaks with existing conventions.</p>



<a name="243873093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873093">(Jun 25 2021 at 03:52)</a>:</h4>
<p>e.g. String::from(str) has no special function, it is expected you use <code>from</code>.</p>



<a name="243873147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873147">(Jun 25 2021 at 03:54)</a>:</h4>
<p>well, there is also <code>ToString::to_string</code> and <code>ToOwned::to_owned</code>, that's a little different</p>



<a name="243873155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873155">(Jun 25 2021 at 03:54)</a>:</h4>
<p>Yes, those exist but for somewhat more Particular reasons.<br>
Also they take the "Into" form.</p>



<a name="243873156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873156">(Jun 25 2021 at 03:54)</a>:</h4>
<p>but generally I think I agree</p>



<a name="243873183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873183">(Jun 25 2021 at 03:55)</a>:</h4>
<p>There's FromIterator but "special Into but not special From" for certain "baked into the language" types is relatively common in <code>std</code>.</p>



<a name="243873185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873185">(Jun 25 2021 at 03:55)</a>:</h4>
<p>using <code>from_str</code>/<code>to_string</code> generally helps with type induction, which is what's special about it, I think</p>



<a name="243873235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873235">(Jun 25 2021 at 03:56)</a>:</h4>
<p>FromStr is a helper for <code>fn parse</code>.</p>



<a name="243873242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873242">(Jun 25 2021 at 03:56)</a>:</h4>
<p>midwife, almost.</p>



<a name="243873251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873251">(Jun 25 2021 at 03:57)</a>:</h4>
<p>that's true</p>



<a name="243873314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873314">(Jun 25 2021 at 03:58)</a>:</h4>
<p>ok so we can strike those fns entirely, agreed</p>



<a name="243873603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873603">(Jun 25 2021 at 04:06)</a>:</h4>
<p>Iterator is a trait I have looked to for inspiration on a few points but it has absolutely a ton of special casing because it's the grounding of <code>for</code> loops, likewise w/ strings and <code>fmt</code> in general having a lot of compiler help.</p>



<a name="243873653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873653">(Jun 25 2021 at 04:07)</a>:</h4>
<p>though I don't want to particularly belabor that point, this is one more library that will have a lot of compiler help <strong>also</strong>.</p>



<a name="243873659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873659">(Jun 25 2021 at 04:07)</a>:</h4>
<p>But I expect on subtly different details.</p>



<a name="243873724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873724">(Jun 25 2021 at 04:09)</a>:</h4>
<p>I think it is worth noting that <code>Iterator</code> only has one required fn</p>



<a name="243873728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873728">(Jun 25 2021 at 04:09)</a>:</h4>
<p>indeed.</p>



<a name="243873738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873738">(Jun 25 2021 at 04:09)</a>:</h4>
<p>I'm sure the others are non-defaulted for various iterators but they can all be derived from just <code>next</code></p>



<a name="243873796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873796">(Jun 25 2021 at 04:10)</a>:</h4>
<p><code>io::Write</code> requires <code>write</code> and <code>flush</code>, interestingly.</p>



<a name="243873872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243873872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243873872">(Jun 25 2021 at 04:12)</a>:</h4>
<p>( I'm not going anywhere with that, I just wondered. )</p>



<a name="243874249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243874249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243874249">(Jun 25 2021 at 04:23)</a>:</h4>
<p>Good news, replacing <code>LanesAtMost32</code> entirely with this trait worked just fine as expected</p>



<a name="243874295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243874295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243874295">(Jun 25 2021 at 04:24)</a>:</h4>
<p>and this way is reasonably extensible in the future, I think, when we add more vector widths</p>



<a name="243877114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243877114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243877114">(Jun 25 2021 at 05:28)</a>:</h4>
<p>fwiw, I took a shot at it and using the const generic LANES parameter w/ SimdArray&lt;LANES&gt; seems to make implementing <code>to_array</code> and making it return <code>[Self::Scalar; LANES]</code> possible. I don't think that const generics are meant to mesh with using associated constants/associated types. Or at least, they don't make it easy.</p>



<a name="243877487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243877487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243877487">(Jun 25 2021 at 05:37)</a>:</h4>
<p>basically any use of const generics that involves using some non-concrete constant as a const param is gated behind <code>const_evaluatable_checked</code></p>



<a name="243877498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243877498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243877498">(Jun 25 2021 at 05:37)</a>:</h4>
<p>which.. yeah, includes assoc consts :(</p>



<a name="243879210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879210">(Jun 25 2021 at 06:13)</a>:</h4>
<p>that isn't a problem if you ask me but I kinda view the selection of which things to draw bounds on as at least somewhat arbitrary</p>



<a name="243879279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879279">(Jun 25 2021 at 06:14)</a>:</h4>
<p>min_const_evaluable_checked when</p>



<a name="243879390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879390">(Jun 25 2021 at 06:16)</a>:</h4>
<p>lul</p>



<a name="243879413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879413">(Jun 25 2021 at 06:17)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> I don't think it's correct to have the lanes as a generic parameter to the trait, since you should only implement the trait once per vector, and you shouldn't have to know the vector width to use it</p>



<a name="243879548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879548">(Jun 25 2021 at 06:20)</a>:</h4>
<p>mmm, I defer on correctness here to the compiler but I do understand the sentiment at least. isn't eliminating a single bound essentially invisible to consumers tho?</p>



<a name="243879590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879590">(Jun 25 2021 at 06:21)</a>:</h4>
<p>Well when I say correct I don't mean defined behavior, I mean is that you for example can't do <code>impl Vector</code>, you need to know the width to use it</p>



<a name="243879678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/243879678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#243879678">(Jun 25 2021 at 06:23)</a>:</h4>
<p>oohhhhhhhhhhhhhh.</p>



<a name="244085869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244085869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244085869">(Jun 27 2021 at 21:28)</a>:</h4>
<p>Regarding <code>{to,from}_array</code>, one thing I did notice is that <code>Vec</code> has both <code>as_slice</code> and <code>AsRef&lt;[T]&gt;</code> so it's not completely unheard of to repeat these things for type inference, I think</p>



<a name="244085957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244085957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244085957">(Jun 27 2021 at 21:30)</a>:</h4>
<p>In my attempt to remove <code>to_array</code> I ended up with <code>AsRef::&lt;[Self::Scalar; LANES]&gt;::as_ref(*self)</code> in two separate places which is pretty nasty</p>



<a name="244090528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244090528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244090528">(Jun 27 2021 at 23:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/244085869">said</a>:</p>
<blockquote>
<p>Regarding <code>{to,from}_array</code>, one thing I did notice is that <code>Vec</code> has both <code>as_slice</code> and <code>AsRef&lt;[T]&gt;</code> so it's not completely unheard of to repeat these things for type inference, I think</p>
</blockquote>
<p>Basically all the advantages of being inherent, yeah.</p>



<a name="244091531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244091531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244091531">(Jun 28 2021 at 00:01)</a>:</h4>
<p>I wonder if perhaps we should have <code>as_array</code> instead?  Since arrays implement <code>Deref&lt;[T]&gt;</code> it's probably strictly better?</p>



<a name="244092011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244092011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244092011">(Jun 28 2021 at 00:16)</a>:</h4>
<p>yes, since we know we have the length info, we should preserve it as long as possible</p>



<a name="244092054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244092054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244092054">(Jun 28 2021 at 00:16)</a>:</h4>
<p>it makes you spend an extra 60 seconds when you first learn the API, but then you get to preserve the length info all the time, so it's a net win</p>



<a name="244092055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244092055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244092055">(Jun 28 2021 at 00:16)</a>:</h4>
<p>unless your long term plans are to use the API for less than 60 seconds total, in which case i care much less about your use case</p>



<a name="244106884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244106884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244106884">(Jun 28 2021 at 06:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/244091531">said</a>:</p>
<blockquote>
<p>I wonder if perhaps we should have <code>as_array</code> instead?  Since arrays implement <code>Deref&lt;[T]&gt;</code> it's probably strictly better?</p>
</blockquote>
<p>Nitpick: arrays implement <a href="https://doc.rust-lang.org/nightly/std/marker/trait.Unsize.html">https://doc.rust-lang.org/nightly/std/marker/trait.Unsize.html</a> not Deref.  (Yes, this distinction is annoying.)</p>



<a name="244109314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244109314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244109314">(Jun 28 2021 at 07:20)</a>:</h4>
<p>Well the SIMD types can just impl both directly then.</p>



<a name="244135039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244135039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244135039">(Jun 28 2021 at 12:14)</a>:</h4>
<p>The difference being <code>Unsize</code> directly coerces at the type level and <code>Deref</code> by repeatedly adding <code>*</code>?</p>



<a name="244135799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244135799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244135799">(Jun 28 2021 at 12:22)</a>:</h4>
<p>i feel like arrays either implement deref also, or have other magic. i remember when playing around with ArrayVec (sample code is linked here <a href="https://github.com/rust-lang/rfcs/pull/2990#issuecomment-848962572">https://github.com/rust-lang/rfcs/pull/2990#issuecomment-848962572</a>), the unsize coersion wasn't enough to allow calling methods of <code>ArrayVec&lt;[T]&gt;</code> on <code>ArrayVec&lt;[T; N]&gt;</code> — it needed a dummy deref coersion, that just returned the argument</p>



<a name="244322529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244322529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244322529">(Jun 29 2021 at 18:04)</a>:</h4>
<p>hm</p>



<a name="244328372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244328372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244328372">(Jun 29 2021 at 18:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/244085869">said</a>:</p>
<blockquote>
<p>Regarding <code>{to,from}_array</code>, one thing I did notice is that <code>Vec</code> has both <code>as_slice</code> and <code>AsRef&lt;[T]&gt;</code> so it's not completely unheard of to repeat these things for type inference, I think</p>
</blockquote>
<p>Makes me grumpy, honestly, but I won't yell too hard about keeping them. I guess my real conceit there is "these are functions which exist only for type inference, it's fine if they have an unpretty implementation."</p>



<a name="244348897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244348897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244348897">(Jun 29 2021 at 21:16)</a>:</h4>
<p>So let me be more direct: I consider the current documentation for <code>u32</code> for Rust to be borderline unreadable, and if SimdU32 has twice the number of functions on the types because it has both SIMD and u32 functions on it, I will consider it to be geometrically worse. "doesn't require imports" is not very meaningful if the consequence is that you have to sift through an undifferentiated mess of functions in order to find anything.  And at the point we will get to, we will have to realistically consider "page load times" to be an obstacle. They are already for other large types with large API surfaces.</p>
<p>At the start I did not consider this to be an issue because I didn't use a lot of numerical code, but I was already aware of different forms of the problem. I hadn't really processed it though. It became more and more glaring as I had to frequently return to the documentation for those types and it started to sink in just how bad the problem was going to get. I introduced this abstraction to make it tenable to mitigate that.</p>



<a name="244349779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244349779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244349779">(Jun 29 2021 at 21:22)</a>:</h4>
<p>The median Rust programmer sees 100 functions and then they close the page, basically. They only interact via programmatic search, and trivial obstacles to search become impossible to defeat. That is to say, they no longer use "search PLUS human reasoning", I mean they stop doing logical things like "check the next function". I know because I have walked people through this for comparatively small types like <code>Option&lt;T&gt;</code> and watched it happen again and again. I know because I have become overwhelmed myself.</p>



<a name="244350348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244350348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244350348">(Jun 29 2021 at 21:27)</a>:</h4>
<p>I think making documentation worse by two functions is better than peppering code with UFCS.  I want to remind you that I originally wanted to support reading directly from pointers/slices to which you pointed out that reading from arrays is better (which is perhaps true).</p>
<p>But now in generic code we have gone from <code>V::load(slice)</code> to <code>V::from_array(slice.try_into().unwrap())</code> to <code>&lt;V as From&lt;&amp;[&lt;V as Vector&gt;::Scalar]&gt;&gt;::from(slice.try_into().unwrap())</code> for something that is so exceptionally common that any simd program will have many instances.</p>



<a name="244351221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351221">(Jun 29 2021 at 21:36)</a>:</h4>
<p>Actually, I made a typo, that inner type in From should be an array, not a slice, which you can't even specify in rust today without const eval checked</p>



<a name="244351297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351297">(Jun 29 2021 at 21:36)</a>:</h4>
<p>I agree UFCS is bad which is why I am not really arguing for it, we can have to/from_array, it's vaguely undesirable on some level to me but Fine, and I don't really care where that is implemented, exactly. Likewise I am actually fine with a generic "load" function. I just don't really want to even suggest exposing the details of registers to users in an API.</p>



<a name="244351351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351351">(Jun 29 2021 at 21:37)</a>:</h4>
<p>Hmm what do you mean by that last part</p>



<a name="244351479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351479">(Jun 29 2021 at 21:38)</a>:</h4>
<p>I don't think you can avoid registers.  If you write SSE and use more than 8 vectors at once you will quickly (slowly actually <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span>) be very aware of registers</p>



<a name="244351501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351501">(Jun 29 2021 at 21:38)</a>:</h4>
<p>Literally I think "load" is a naughty word, in essence. That gets us complaints that our "load" function immediately spills to memory, omg!!! how dare you suggest you are LOADING from memory into a REGISTER! but I used 17 loads on an x86-64 system and for some reason it spills to memory!</p>



<a name="244351546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351546">(Jun 29 2021 at 21:39)</a>:</h4>
<p>( note to the audience: x86-64 systems only have 16 vector registers except with certain very late extensions )</p>



<a name="244351618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351618">(Jun 29 2021 at 21:40)</a>:</h4>
<p>Oh sure we can bikeshed naming, could be <code>copy_from_slice</code> to be consistent</p>



<a name="244351691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351691">(Jun 29 2021 at 21:41)</a>:</h4>
<p>I was basically going to circle back at some point to this and suggest simply <code>from_slice</code> if I didn't come up with a better idea (I didn't).</p>



<a name="244351694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351694">(Jun 29 2021 at 21:41)</a>:</h4>
<p>Loading from slices is less important to me as long as we still have some sort of non-generic function for type inference</p>



<a name="244351706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351706">(Jun 29 2021 at 21:41)</a>:</h4>
<p>yeah.</p>



<a name="244351747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351747">(Jun 29 2021 at 21:41)</a>:</h4>
<p>I think "constructors" in particular can largely be somewhere-else than the Vector trait.</p>



<a name="244351796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351796">(Jun 29 2021 at 21:42)</a>:</h4>
<p>gather is a bit of a special case here.</p>



<a name="244351798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351798">(Jun 29 2021 at 21:42)</a>:</h4>
<p>Slices are trivially convertible to array references relatively recently so it's not a big deal really</p>



<a name="244351893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244351893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244351893">(Jun 29 2021 at 21:43)</a>:</h4>
<p>I actually don't think gather is any more special than splat other than being more cognitively draining</p>



<a name="244352048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352048">(Jun 29 2021 at 21:44)</a>:</h4>
<p>I agree, oddly enough? hmm I didn't mean constructor, I meant...</p>



<a name="244352094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352094">(Jun 29 2021 at 21:45)</a>:</h4>
<p>something like Direct Translation?</p>



<a name="244352122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352122">(Jun 29 2021 at 21:45)</a>:</h4>
<p><code>safe_transmute</code> lol</p>



<a name="244352253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352253">(Jun 29 2021 at 21:46)</a>:</h4>
<p>splat and gather are both non-transmutations.</p>



<a name="244352281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352281">(Jun 29 2021 at 21:47)</a>:</h4>
<p>Ah yeah</p>



<a name="244352300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352300">(Jun 29 2021 at 21:47)</a>:</h4>
<p>BITCASTS</p>



<a name="244352349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352349">(Jun 29 2021 at 21:47)</a>:</h4>
<p>Even then I think array conversions are a little special only because arrays are a built in type</p>



<a name="244352398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244352398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244352398">(Jun 29 2021 at 21:48)</a>:</h4>
<p>Just like anything with slices are a little special</p>



<a name="244353026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244353026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244353026">(Jun 29 2021 at 21:54)</a>:</h4>
<p>A little.</p>



<a name="244371546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/244371546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#244371546">(Jun 30 2021 at 02:38)</a>:</h4>
<p>to_array / from_array are just putting a clear label on a particular bitcast we expect people to frequently do. In other words: If we didn't provide them as methods you'd still be able to do it on your own anyway.</p>
<p>We could have just into/from for arrays, which would be non-generic as caleb asks, and also would be stuffed far down in the docs as you want jubilee, but I think the idea was to have the visibility of extra methods with a special name for learnability reasons.</p>



<a name="245487275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245487275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245487275">(Jul 09 2021 at 19:33)</a>:</h4>
<p>So, re: not being able to use <code>dyn Vector</code>:<br>
That doesn't matter because <code>Vector</code> isn't object-safe.</p>



<a name="245487438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245487438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245487438">(Jul 09 2021 at 19:34)</a>:</h4>
<p>What about <code>fn foo&lt;V: Vector&gt;(v: V)</code>?</p>



<a name="245487475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245487475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245487475">(Jul 09 2021 at 19:35)</a>:</h4>
<p>So I believe we are restricted to considering the ergonomics of... yeah that.</p>



<a name="245487631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245487631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245487631">(Jul 09 2021 at 19:36)</a>:</h4>
<p>Also it would be object safe without splat right?  Which I think is perhaps still questionable</p>



<a name="245487987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245487987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245487987">(Jul 09 2021 at 19:40)</a>:</h4>
<p>Not that we need to address that now, but I don't think it's a given what <code>Vector</code> should and shouldn't have yet</p>



<a name="245491682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245491682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245491682">(Jul 09 2021 at 20:11)</a>:</h4>
<p>Vector without an element type has very few operations, but still a few operations.</p>



<a name="245492912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245492912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245492912">(Jul 09 2021 at 20:21)</a>:</h4>
<p>If we just had to/from [T;N] and also load/store using &amp;[T;N] and &amp;mut [T;N], that seems fine. I think the "good code" there would be to cast the slice once at the start and then you don't need to try_into().unwrap() on a per element basis.</p>



<a name="245493351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493351">(Jul 09 2021 at 20:25)</a>:</h4>
<p>Do you mean on the trait? Or just generally on vector types</p>



<a name="245493428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493428">(Jul 09 2021 at 20:26)</a>:</h4>
<p>i mean "what methods does the trait have"</p>



<a name="245493459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493459">(Jul 09 2021 at 20:26)</a>:</h4>
<p>But I think the real problem to a vector trait is that if scalar numbers don't get a trait, and arrays don't get a trait, why does simd get a trait? It seems like a political willpower issue rather than a strictly technical problem.</p>



<a name="245493500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493500">(Jul 09 2021 at 20:27)</a>:</h4>
<p>The trait can't have anything referencing arrays, since we can't have the lane count in a type</p>



<a name="245493563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493563">(Jul 09 2021 at 20:27)</a>:</h4>
<blockquote>
<h2>Object Safety</h2>
<p>Object safe traits can be the base trait of a [trait object]. A trait is<br>
<em>object safe</em> if it has the following qualities (defined in [RFC 255]):</p>
<ul>
<li>All [supertraits] must also be object safe.</li>
<li><code>Sized</code> must not be a [supertrait][supertraits]. In other words, it must not require <code>Self: Sized</code>.</li>
<li>It must not have any associated constants.</li>
<li>All associated functions must either be dispatchable from a trait object or be explicitly non-dispatchable:<br>
    * Dispatchable functions require:<br>
        * Not have any type parameters (although lifetime parameters are allowed),<br>
        * Be a [method] that does not use <code>Self</code> except in the type of the receiver.<br>
        * Have a receiver with one of the following types:<br>
            * <code>&amp;Self</code> (i.e. <code>&amp;self</code>)<br>
            * <code>&amp;mut Self</code> (i.e <code>&amp;mut self</code>)<br>
            * [<code>Box&lt;Self&gt;</code>]<br>
            * [<code>Rc&lt;Self&gt;</code>]<br>
            * [<code>Arc&lt;Self&gt;</code>]<br>
            * [<code>Pin&lt;P&gt;</code>] where <code>P</code> is one of the types above<br>
        * Does not have a <code>where Self: Sized</code> bound (receiver type of <code>Self</code> (i.e. <code>self</code>) implies this).<br>
    * Explicitly non-dispatchable functions require:<br>
        * Have a <code>where Self: Sized</code> bound (receiver type of <code>Self</code> (i.e. <code>self</code>) implies this).</li>
</ul>
</blockquote>



<a name="245493566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493566">(Jul 09 2021 at 20:27)</a>:</h4>
<p>oh is that a limit we have to still live by? poop</p>



<a name="245493574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493574">(Jul 09 2021 at 20:27)</a>:</h4>
<p>Yup</p>



<a name="245493651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493651">(Jul 09 2021 at 20:28)</a>:</h4>
<p>Const generics are good enough to get us generic types and impls and it ends about there</p>



<a name="245493694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493694">(Jul 09 2021 at 20:28)</a>:</h4>
<p>well get with it const generics folks, just pull out  another rabbit already</p>



<a name="245493713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493713">(Jul 09 2021 at 20:28)</a>:</h4>
<p>Array is formally a type lol.</p>



<a name="245493759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493759">(Jul 09 2021 at 20:29)</a>:</h4>
<p>yeah we can make the array type an associated type and not be generic over the lanes</p>



<a name="245493764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493764">(Jul 09 2021 at 20:29)</a>:</h4>
<p>Sorry, by types I meant type definitions</p>



<a name="245493792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493792">(Jul 09 2021 at 20:29)</a>:</h4>
<p>but that's probably not helpful to not be generic over the lane count</p>



<a name="245493804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493804">(Jul 09 2021 at 20:29)</a>:</h4>
<p>It is very hard, I would argue even impossible, to make Vector do anything vaguely like what we want and also be object safe. I would support having an object-safe supertrait (or subtrait?) of Vector, if we wanted to do that.</p>



<a name="245493820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493820">(Jul 09 2021 at 20:30)</a>:</h4>
<p>You can't reference types with dependent const generics</p>



<a name="245493908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493908">(Jul 09 2021 at 20:30)</a>:</h4>
<p>I would have no idea what it was for, mind.</p>



<a name="245493945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493945">(Jul 09 2021 at 20:31)</a>:</h4>
<p>Well that's what I'm wondering, for now do we just want the element type and the lane count since there is absolutely no other way to get that?</p>



<a name="245493988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245493988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245493988">(Jul 09 2021 at 20:31)</a>:</h4>
<p>My main goal was to embed the element type relationship and use it to produce nicer looking code, yes.</p>



<a name="245494077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494077">(Jul 09 2021 at 20:32)</a>:</h4>
<p>like... I assume that eventually this will become useful to external users, but I want to see what they do with a somewhat messy version first before I leap to assumptions.</p>



<a name="245494127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494127">(Jul 09 2021 at 20:32)</a>:</h4>
<p>That's kind of why I wanted to elevate things into the trait where plausible.</p>



<a name="245494132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494132">(Jul 09 2021 at 20:32)</a>:</h4>
<p>I also cannot imagine what object-safe simd would even usefully do</p>



<a name="245494177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494177">(Jul 09 2021 at 20:33)</a>:</h4>
<p>I also personally started a simd-traits crate which should fill the useful-but-not-std-simple gap</p>



<a name="245494182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494182">(Jul 09 2021 at 20:33)</a>:</h4>
<p>I also figure that "it's hard to write generics over the trait and requires additional nightly unstable features" would be... fine? Not great but fine.</p>



<a name="245494224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494224">(Jul 09 2021 at 20:33)</a>:</h4>
<p>I think people mostly want to be generic over lane count</p>



<a name="245494271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494271">(Jul 09 2021 at 20:34)</a>:</h4>
<p>but not element type</p>



<a name="245494306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494306">(Jul 09 2021 at 20:34)</a>:</h4>
<p>So the thing is... You can be generic over lane count without using const generics</p>



<a name="245494314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494314">(Jul 09 2021 at 20:34)</a>:</h4>
<p>And that I would be happy with demolishing the trait if it is shown to not provide anything terribly useful in terms of writing generics later.</p>



<a name="245494320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494320">(Jul 09 2021 at 20:34)</a>:</h4>
<p>CURRENTLY.</p>



<a name="245494363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494363">(Jul 09 2021 at 20:35)</a>:</h4>
<p>I swear to Ferris if I have to fucking fix the compiler myself to make it work I'll fucking do it. <span aria-label="crab" class="emoji emoji-1f980" role="img" title="crab">:crab:</span></p>



<a name="245494516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494516">(Jul 09 2021 at 20:36)</a>:</h4>
<p>I've only ever talked to people that had some float op lib function they wanted to have happen at whatever lane count the user was ready to use. But ive never once heard someone seriously ask to do something on both u32 simd and also u16 simd, for example</p>



<a name="245494524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494524">(Jul 09 2021 at 20:36)</a>:</h4>
<p>Ahem.<br>
Excusez mon français.<br>
There was no other language that could convey the sentiment adequately.</p>



<a name="245494529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494529">(Jul 09 2021 at 20:36)</a>:</h4>
<p>As long as you know what the lane count is inside your generic you usually don't actually need const generics, so for now I don't think we need to worry about if it's usable without const eval checked</p>



<a name="245494571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494571">(Jul 09 2021 at 20:36)</a>:</h4>
<p>but maybe that's because standard rust doesn't have u16/u32 generics so rust programmers just don't think like that to begin with.</p>



<a name="245494577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494577">(Jul 09 2021 at 20:36)</a>:</h4>
<p>I think people are going to be more interested, imo, in writing things that hit both scalar and vector versions.</p>



<a name="245494605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494605">(Jul 09 2021 at 20:37)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> generic over element is definitely useful, in a num-traits kind of way</p>



<a name="245494633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494633">(Jul 09 2021 at 20:37)</a>:</h4>
<p>But it's probably useful somewhat less frequently</p>



<a name="245494678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494678">(Jul 09 2021 at 20:37)</a>:</h4>
<p>right but most people dont yet think that way. if our design is open to having that later after a scalar version of int generics then that's probably enough</p>



<a name="245494679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494679">(Jul 09 2021 at 20:37)</a>:</h4>
<p>which is why I focused on the assoc type.</p>



<a name="245494757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245494757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245494757">(Jul 09 2021 at 20:38)</a>:</h4>
<p>But! going async. Will update later.</p>



<a name="245734698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/245734698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Miguel Raz Guzmán Macedo <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#245734698">(Jul 12 2021 at 19:19)</a>:</h4>
<p>On the generic numerics point: there's applications where numerical codes see 3x speedups from switxhig to Float16 from Float32 in a region that they know requires less precision. And then other gnarlier algos can happen ny also accepting BigFloats, but that's for another day.</p>



<a name="247033340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247033340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247033340">(Jul 23 2021 at 21:12)</a>:</h4>
<p>I'm pretty happy with the direction of <a href="https://github.com/rust-lang/stdsimd/issues/124">stdsimd#124</a> but I wonder if there's something we can do better for enforcing the lane count that doesn't result in leaking implementation details of which specific vector types are used by a generic function (for example <code>where SimdU32&lt;LANES&gt;: Vector</code>)</p>
<div class="codehilite"><pre><span></span><code>struct LaneCount&lt;N&gt;([(); N]);
trait SupportedLaneCount: Sealed {}

...

fn foo&lt;const LANES: usize&gt;(...) where LaneCount&lt;LANES&gt;: SupportedLaneCount { ... }
</code></pre></div>



<a name="247033510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247033510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247033510">(Jul 23 2021 at 21:13)</a>:</h4>
<p>If we happen to get const bounds before stabilization we can change it to that--but I think this is more or less as close as we can get for now</p>



<a name="247044910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247044910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247044910">(Jul 23 2021 at 23:47)</a>:</h4>
<p>Hmm.</p>



<a name="247045973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247045973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247045973">(Jul 24 2021 at 00:07)</a>:</h4>
<p>couldn't you just use <code>pub struct LaneCount&lt;const LANES: usize&gt;;</code> instead of needing an array?</p>



<a name="247046511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247046511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247046511">(Jul 24 2021 at 00:19)</a>:</h4>
<p>Hmm, I think it will complain about the unused const, but perhaps</p>



<a name="247046592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247046592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247046592">(Jul 24 2021 at 00:21)</a>:</h4>
<p>Though, having an internal member also prevents it from being initialized (no idea if that matters at all)</p>



<a name="247047475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047475">(Jul 24 2021 at 00:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/247046511">said</a>:</p>
<blockquote>
<p>Hmm, I think it will complain about the unused const, but perhaps</p>
</blockquote>
<p>no complaints from rustc or clippy:<br>
<a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=4e23ed21ded12a2da8ce6e9b232cd8c6">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=4e23ed21ded12a2da8ce6e9b232cd8c6</a></p>



<a name="247047492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047492">(Jul 24 2021 at 00:43)</a>:</h4>
<p>Interesting that you need phantom data for types</p>



<a name="247047533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047533">(Jul 24 2021 at 00:44)</a>:</h4>
<p>Some type astronaut could probably explain the difference</p>



<a name="247047536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047536">(Jul 24 2021 at 00:44)</a>:</h4>
<p>that's because types need to handle variance, const generics don't have that</p>



<a name="247047539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047539">(Jul 24 2021 at 00:44)</a>:</h4>
<p>Hmm</p>



<a name="247047546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047546">(Jul 24 2021 at 00:45)</a>:</h4>
<p>yep, basically const generics dont have subtyping but lifetimes and types do so you need a phantom data <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="247047616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047616">(Jul 24 2021 at 00:47)</a>:</h4>
<p>Ah that makes sense</p>



<a name="247047667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047667">(Jul 24 2021 at 00:48)</a>:</h4>
<p>So the implication here is that all vector types have the same valid lane counts</p>



<a name="247047691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247047691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247047691">(Jul 24 2021 at 00:49)</a>:</h4>
<p>Which is not just reasonable but probably convenient (like not leaking specific vector types in generic bounds)</p>



<a name="247056446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247056446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247056446">(Jul 24 2021 at 05:02)</a>:</h4>
<p>If anyone is curious I implemented this and added it to <a href="https://github.com/rust-lang/stdsimd/issues/124">stdsimd#124</a>.  It actually simplified a lot--there were a bunch of places where we had 2+ bounds (sometimes 4!) that all got replaced with the single lane count bound.  But an unexpected benefit is how much it simplified the mask implementation, they used to be generic on both the public mask type and the lane count, but now they are only generic over the lane count</p>



<a name="247056522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247056522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247056522">(Jul 24 2021 at 05:05)</a>:</h4>
<p>This is a good example: <a href="https://github.com/rust-lang/stdsimd/pull/142/files#diff-a7db8455cfa81269184255b74165bb95f946da7ce60045418517347d846c3fd4L79-L85">https://github.com/rust-lang/stdsimd/pull/142/files#diff-a7db8455cfa81269184255b74165bb95f946da7ce60045418517347d846c3fd4L79-L85</a></p>
<p>Some of the float functions have </p>
<div class="codehilite"><pre><span></span><code>        impl&lt;const LANES: usize&gt; $name&lt;LANES&gt;
        where
            Self: crate::LanesAtMost32,
            crate::$bits_ty&lt;LANES&gt;: crate::LanesAtMost32,
            crate::$mask_impl_ty&lt;LANES&gt;: crate::LanesAtMost32,
            crate::$mask_ty&lt;LANES&gt;: crate::Mask,
</code></pre></div>
<p>which are now replaced with just the single <code>LaneCount&lt;LANES&gt;: SupportedLaneCount</code> bound</p>



<a name="247056574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247056574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247056574">(Jul 24 2021 at 05:06)</a>:</h4>
<p>That's important if we want to change the implementation in the future in such a way that uses new types, because we can't add more bounds</p>



<a name="247056579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247056579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247056579">(Jul 24 2021 at 05:06)</a>:</h4>
<p>(after stabilization, I mean)</p>



<a name="247061041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247061041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247061041">(Jul 24 2021 at 07:21)</a>:</h4>
<p>oh wow.</p>



<a name="247091838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247091838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247091838">(Jul 24 2021 at 20:32)</a>:</h4>
<p>Lemme play with this for a sec now that it's rebased.</p>



<a name="247094103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094103">(Jul 24 2021 at 21:12)</a>:</h4>
<p>hmmm why can't I reelevate this back to the assoc const or bound the assoc const... ugh!</p>



<a name="247094196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094196">(Jul 24 2021 at 21:15)</a>:</h4>
<p><span class="user-mention" data-user-id="326176">@Boxy [she/her]</span> Is this just unsupported semantics? I am not even getting "did you want to enable a feature?" alerts.</p>



<a name="247094254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094254">(Jul 24 2021 at 21:16)</a>:</h4>
<p>can you elaborate a bit? Im not sure exactly what you're trying to do</p>



<a name="247094327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094327">(Jul 24 2021 at 21:18)</a>:</h4>
<p>I think this is just<code>const_evaluatable_checked</code> but: associated types accept bounds, I would expect associated constants also do.</p>



<a name="247094387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094387">(Jul 24 2021 at 21:20)</a>:</h4>
<p>ah you want to do <code>T: Trait&lt;ASSOC = 10&gt;</code> like you can with types?</p>



<a name="247094470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094470">(Jul 24 2021 at 21:22)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span> <span class="nc">where</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span>: <span class="nc">crate</span>::<span class="n">SupportedLaneCount</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="247094474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094474">(Jul 24 2021 at 21:22)</a>:</h4>
<p>or something like that</p>



<a name="247094488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094488">(Jul 24 2021 at 21:23)</a>:</h4>
<p>I think that won't work because there actually are no const bounds at all yet</p>



<a name="247094496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094496">(Jul 24 2021 at 21:23)</a>:</h4>
<p>aha.</p>



<a name="247094498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094498">(Jul 24 2021 at 21:23)</a>:</h4>
<p>It just happens to be that we can use type bounds to do some const bounds</p>



<a name="247094570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094570">(Jul 24 2021 at 21:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector/near/247094470">said</a>:</p>
<blockquote>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span> <span class="nc">where</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span>: <span class="nc">crate</span>::<span class="n">SupportedLaneCount</span><span class="p">;</span><span class="w"></span>
</code></pre></div><br>
</p>
</blockquote>
<p>ah right yeah that isnt supported <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span></p>



<a name="247094571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094571">(Jul 24 2021 at 21:25)</a>:</h4>
<p>i think that's not even supported on types without GATs?</p>



<a name="247094576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094576">(Jul 24 2021 at 21:25)</a>:</h4>
<p>where clauses I mean</p>



<a name="247094590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094590">(Jul 24 2021 at 21:25)</a>:</h4>
<p>Yeah I don't think you can require it on assoc types, you can do them on implementations but not require it for a trait, I think</p>



<a name="247094594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094594">(Jul 24 2021 at 21:25)</a>:</h4>
<p>i am a bit confused by you putting a trait bound on an associated const though</p>



<a name="247094634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094634">(Jul 24 2021 at 21:26)</a>:</h4>
<p>Not full where clauses I mean. You can of course do the more limited type of just listing traits</p>



<a name="247094646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094646">(Jul 24 2021 at 21:26)</a>:</h4>
<p>You know how you can do <code>type Foo: Bar</code>? I think jubilee basically wants that but for a const value</p>



<a name="247094652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094652">(Jul 24 2021 at 21:26)</a>:</h4>
<p>yeah.</p>



<a name="247094666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094666">(Jul 24 2021 at 21:27)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">type</span> <span class="nc">Scalar</span>: <span class="nb">Copy</span> <span class="o">+</span><span class="w"> </span><span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="247094735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094735">(Jul 24 2021 at 21:28)</a>:</h4>
<p>right but consts dont implement traits</p>



<a name="247094755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094755">(Jul 24 2021 at 21:29)</a>:</h4>
<p>^^; That is a good point but eh</p>



<a name="247094763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094763">(Jul 24 2021 at 21:29)</a>:</h4>
<p>I'm not sure what you're actually trying to express with <code>Self::LANES: Trait</code> (was it a typo?)</p>



<a name="247094875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247094875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247094875">(Jul 24 2021 at 21:32)</a>:</h4>
<p>poking at finding a way to inject this bound in other ways:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">where</span><span class="w"> </span><span class="n">LaneCount</span><span class="o">&lt;</span><span class="n">LANES</span><span class="o">&gt;</span>: <span class="nc">SupportedLaneCount</span><span class="w"></span>
</code></pre></div>



<a name="247095020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247095020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247095020">(Jul 24 2021 at 21:36)</a>:</h4>
<p>Ah yes, that's the intention of my changes. Since you can't actually specify const bounds yet, wrap it in a type</p>



<a name="247095210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247095210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247095210">(Jul 24 2021 at 21:43)</a>:</h4>
<p>yuh. Pondering... hm.</p>



<a name="247096433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096433">(Jul 24 2021 at 22:20)</a>:</h4>
<p>Well this works with <code>#![feature(const_evaluatable_checked)]</code>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Vector</span>: <span class="nc">sealed</span>::<span class="n">Sealed</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The scalar type in every lane of this vector type.</span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Scalar</span>: <span class="nb">Copy</span> <span class="o">+</span><span class="w"> </span><span class="nb">Sized</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="sd">/// The number of lanes for this vector.</span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">LANES</span>: <span class="kt">usize</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="sd">/// Generates a SIMD vector with the same value in every lane.</span>
<span class="w">    </span><span class="cp">#[must_use]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">splat</span><span class="p">(</span><span class="n">val</span>: <span class="nc">Self</span>::<span class="n">Scalar</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="cp">#[must_use]</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[inline]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">gather_select</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="n">slice</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="bp">Self</span>::<span class="n">Scalar</span><span class="p">],</span><span class="n">yyyy</span><span class="w"></span>
<span class="w">        </span><span class="n">mask</span>: <span class="nc">crate</span>::<span class="n">MaskSize</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">idxs</span>: <span class="nc">crate</span>::<span class="n">SimdUsize</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">or</span>: <span class="nc">Self</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"></span>
<span class="w">    </span><span class="k">where</span><span class="w"></span>
<span class="w">        </span><span class="k">crate</span>::<span class="n">LaneCount</span><span class="o">&lt;</span><span class="p">{</span><span class="w"> </span><span class="bp">Self</span>::<span class="n">LANES</span><span class="w"> </span><span class="p">}</span><span class="o">&gt;</span>: <span class="nc">crate</span>::<span class="n">SupportedLaneCount</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="bp">Self</span>: <span class="nb">Sized</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">mask</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">mask</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">idxs</span><span class="p">.</span><span class="n">lanes_lt</span><span class="p">(</span><span class="k">crate</span>::<span class="n">SimdUsize</span>::<span class="n">splat</span><span class="p">(</span><span class="n">slice</span><span class="p">.</span><span class="n">len</span><span class="p">()))).</span><span class="n">to_int</span><span class="p">();</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">base_ptr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">crate</span>::<span class="n">vector</span>::<span class="n">ptr</span>::<span class="n">SimdConstPtr</span>::<span class="n">splat</span><span class="p">(</span><span class="n">slice</span><span class="p">.</span><span class="n">as_ptr</span><span class="p">());</span><span class="w"></span>
<span class="w">        </span><span class="c1">// Ferris forgive me, I have done pointer arithmetic here.</span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">ptrs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">base_ptr</span><span class="p">.</span><span class="n">wrapping_add</span><span class="p">(</span><span class="n">idxs</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="c1">// SAFETY: The ptrs have been bounds-masked to prevent memory-unsafe reads insha'allah</span>
<span class="w">        </span><span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">crate</span>::<span class="n">intrinsics</span>::<span class="n">simd_gather</span><span class="p">(</span><span class="n">or</span><span class="p">,</span><span class="w"> </span><span class="n">ptrs</span><span class="p">,</span><span class="w"> </span><span class="n">mask</span><span class="p">)</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="247096495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096495">(Jul 24 2021 at 22:22)</a>:</h4>
<p>Oh good, then we're closer to something workable there than I thought</p>



<a name="247096504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096504">(Jul 24 2021 at 22:22)</a>:</h4>
<p>Though I think the lane count change helped because you don't have a generic type dependence anymore</p>



<a name="247096508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096508">(Jul 24 2021 at 22:22)</a>:</h4>
<p>yup!</p>



<a name="247096513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096513">(Jul 24 2021 at 22:23)</a>:</h4>
<p>I still don't think we should be using const eval checked, but I'm glad we're close</p>



<a name="247096515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096515">(Jul 24 2021 at 22:23)</a>:</h4>
<p>That's what motivated me to take a swing at it.</p>



<a name="247096521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096521">(Jul 24 2021 at 22:23)</a>:</h4>
<p>Good idea, didn't even click for me when I did it</p>



<a name="247096640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096640">(Jul 24 2021 at 22:26)</a>:</h4>
<p>I wonder if this has any implications for <code>to_bits</code> or <code>to_bitmask</code> since they have similar issues</p>



<a name="247096675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096675">(Jul 24 2021 at 22:27)</a>:</h4>
<p>I'd be tempted to enable const eval checked if we could somehow only allow it on select functions that require it</p>



<a name="247096780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096780">(Jul 24 2021 at 22:30)</a>:</h4>
<p>You're concerned about it "leaking" out of Vector?</p>



<a name="247096786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096786">(Jul 24 2021 at 22:30)</a>:</h4>
<p>Actually I'm just concerned that we may accidentally use it somewhere we didn't realize</p>



<a name="247096791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096791">(Jul 24 2021 at 22:30)</a>:</h4>
<p>( I am not saying that is not a valid concern. )</p>



<a name="247096793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096793">(Jul 24 2021 at 22:30)</a>:</h4>
<p>aha.</p>



<a name="247096806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096806">(Jul 24 2021 at 22:31)</a>:</h4>
<p>We could add a const eval checked cargo feature?</p>



<a name="247096814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096814">(Jul 24 2021 at 22:31)</a>:</h4>
<p>how would that help, exactly?</p>



<a name="247096823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096823">(Jul 24 2021 at 22:31)</a>:</h4>
<p>Oh, if we test both versions in CI?</p>



<a name="247096936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247096936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247096936">(Jul 24 2021 at 22:34)</a>:</h4>
<p>Yep!</p>



<a name="247097189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097189">(Jul 24 2021 at 22:42)</a>:</h4>
<p>Sounds good to me! ^^</p>



<a name="247097197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097197">(Jul 24 2021 at 22:43)</a>:</h4>
<p>Perhaps that should be a separate PR</p>



<a name="247097198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097198">(Jul 24 2021 at 22:44)</a>:</h4>
<p>yes. :P</p>



<a name="247097308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097308">(Jul 24 2021 at 22:46)</a>:</h4>
<p>The back and forth might look a little silly but looking a little silly is better than uh whatever that unholy pile-on would turn into.</p>



<a name="247097814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097814">(Jul 24 2021 at 23:02)</a>:</h4>
<p>Merged!</p>



<a name="247097972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247097972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247097972">(Jul 24 2021 at 23:08)</a>:</h4>
<p>Thanks!</p>



<a name="247414437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247414437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247414437">(Jul 28 2021 at 02:00)</a>:</h4>
<p>An interesting thing to note about const eval checked... I tested changing <code>{to,from}_bitmask</code> to use const eval checked and I was able to compile the core_simd crate, but when I attempted to actually call the function for some reason it failed during type inference.  I'm guessing this could also occur with scatter/gather</p>



<a name="247414488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247414488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247414488">(Jul 28 2021 at 02:01)</a>:</h4>
<p>what error are you getting?</p>



<a name="247414499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247414499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247414499">(Jul 28 2021 at 02:01)</a>:</h4>
<p>(and do you ahve const eval checked enabled in the calling crate?)</p>



<a name="247414513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247414513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247414513">(Jul 28 2021 at 02:01)</a>:</h4>
<p>I did try that as well. Let me pull it up</p>



<a name="247414528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247414528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247414528">(Jul 28 2021 at 02:01)</a>:</h4>
<p>Maybe I can make a smaller example</p>



<a name="247415281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415281">(Jul 28 2021 at 02:19)</a>:</h4>
<p>So actually, first problem I run into is:</p>
<div class="codehilite"><pre><span></span><code>macro_rules! impl_to_bytes {
    { $name:ident, $size:literal } =&gt; {
        impl&lt;const LANES: usize&gt; crate::$name&lt;LANES&gt;
        where
            crate::LaneCount&lt;LANES&gt;: crate::SupportedLaneCount,
            crate::LaneCount&lt;{{ $size * LANES }}&gt;: crate::SupportedLaneCount,
        {
            /// Return the memory representation of this integer as a byte array in native byte
            /// order.
            pub fn to_ne_bytes(self) -&gt; crate::SimdU8&lt;{{ $size * LANES }}&gt; {
                unsafe { core::mem::transmute_copy(&amp;self) }
            }

            /// Create a native endian integer value from its memory representation as a byte array
            /// in native endianness.
            pub fn from_ne_bytes(bytes: crate::SimdU8&lt;{{ $size * LANES }}&gt;) -&gt; Self {
                unsafe { core::mem::transmute_copy(&amp;bytes) }
            }
        }
    }
}
</code></pre></div>



<a name="247415302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415302">(Jul 28 2021 at 02:19)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: constant expression depends on a generic parameter
  --&gt; crates/core_simd/src/to_bytes.rs:6:52
   |
6  |             crate::LaneCount&lt;{{ $size * LANES }}&gt;: crate::SupportedLaneCount,
   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
...
23 | impl_to_bytes! { SimdU8, 1 }
   | ---------------------------- in this macro invocation
   |
   = note: this may fail depending on what value the parameter takes                                                                                                                                                                                                                                                            = note: this error originates in the macro `impl_to_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
</code></pre></div>



<a name="247415363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415363">(Jul 28 2021 at 02:20)</a>:</h4>
<p>oh wait</p>



<a name="247415366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415366">(Jul 28 2021 at 02:20)</a>:</h4>
<p>Ignore that :)</p>



<a name="247415368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415368">(Jul 28 2021 at 02:20)</a>:</h4>
<p>:3</p>



<a name="247415387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415387">(Jul 28 2021 at 02:21)</a>:</h4>
<p>(with the feature actually properly enabled this does compile!)</p>



<a name="247415456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415456">(Jul 28 2021 at 02:22)</a>:</h4>
<p>This is the test:</p>
<div class="codehilite"><pre><span></span><code>#![feature(portable_simd, const_evaluatable_checked)]

use core_simd::SimdU32;

#[test]
fn byte_convert() {
    let int = SimdU32::from_array([0xdeadbeef, 0x8badf00d]);
    let bytes = int.to_ne_bytes();
    assert_eq!(int[0].to_ne_bytes(), bytes[..4]);
    assert_eq!(int[1].to_ne_bytes(), bytes[4..]);
    assert_eq!(SimdU32::from_ne_bytes(bytes), int);
}
</code></pre></div>



<a name="247415467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415467">(Jul 28 2021 at 02:23)</a>:</h4>
<p>And the error:</p>
<div class="codehilite"><pre><span></span><code>error[E0599]: the function or associated item `from_ne_bytes` exists for struct `SimdU32&lt;{_: usize}&gt;`, but its trait bounds were not satisfied
  --&gt; crates/core_simd/tests/to_bytes.rs:11:25
   |
11 |     assert_eq!(SimdU32::from_ne_bytes(bytes), int);
   |                         ^^^^^^^^^^^^^ function or associated item cannot be called on `SimdU32&lt;{_: usize}&gt;` due to unsatisfied trait bounds
   |
  ::: /home/caleb/stdsimd/crates/core_simd/src/lane_count.rs:7:1
   |
7  | pub struct LaneCount&lt;const LANES: usize&gt;;
   | ----------------------------------------- doesn&#39;t satisfy `LaneCount&lt;{_: usize}&gt;: SupportedLaneCount`
   |
   = note: the following trait bounds were not satisfied:
           `LaneCount&lt;{_: usize}&gt;: SupportedLaneCount`
</code></pre></div>



<a name="247415506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415506">(Jul 28 2021 at 02:24)</a>:</h4>
<p>im not sure how well <code>const_evaluatable_checked</code> works without <code>const_generics</code> i usually enable both</p>



<a name="247415524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415524">(Jul 28 2021 at 02:24)</a>:</h4>
<p>That is a good point.</p>



<a name="247415613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415613">(Jul 28 2021 at 02:26)</a>:</h4>
<p>...and there you have it, it works with <code>const_generics</code></p>



<a name="247415617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415617">(Jul 28 2021 at 02:26)</a>:</h4>
<p>thank you for your insight, I would never have figured that out</p>



<a name="247415625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415625">(Jul 28 2021 at 02:27)</a>:</h4>
<p>ah <span aria-label="fire" class="emoji emoji-1f525" role="img" title="fire">:fire:</span></p>



<a name="247415627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415627">(Jul 28 2021 at 02:27)</a>:</h4>
<p>glad that worked out <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="247415629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415629">(Jul 28 2021 at 02:27)</a>:</h4>
<p>I wonder if the <code>const_evaluatable_checked</code> can require <code>const_generics</code> since it doesn't seem to make sense to enable one without the other</p>



<a name="247415636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415636">(Jul 28 2021 at 02:28)</a>:</h4>
<p>I don't actually know if features can require other features...</p>



<a name="247415737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/247415737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#247415737">(Jul 28 2021 at 02:30)</a>:</h4>
<p>I dont know either <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="248295064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/SimdArray%20/%20Vector/near/248295064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/SimdArray.20.2F.20Vector.html#248295064">(Aug 03 2021 at 23:57)</a>:</h4>
<p>Wondering if GATs help here, hm.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>